home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{E112F284-62AB-11D1-A1FA-00C0DFE045F2}#1.2#0"; "ccrpani.ocx"
- Begin VB.Form frmMain
- Caption = "CCRP Animation Control Demo"
- ClientHeight = 6948
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 7032
- ClipControls = 0 'False
- LinkTopic = "Form1"
- ScaleHeight = 6948
- ScaleWidth = 7032
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton cmdEnd
- Caption = "End"
- Height = 432
- Left = 2280
- TabIndex = 21
- Top = 6420
- Width = 2232
- End
- Begin VB.Frame fra
- Caption = "Events"
- ForeColor = &H00C00000&
- Height = 1572
- Index = 3
- Left = 300
- TabIndex = 19
- Top = 3600
- Width = 6372
- Begin VB.CommandButton cmdClearEvents
- Caption = "Clear List"
- Height = 432
- Left = 4920
- TabIndex = 13
- ToolTipText = "Clears the event history"
- Top = 960
- Width = 1332
- End
- Begin VB.CheckBox chkOtherEvents
- Caption = "Other Events"
- ForeColor = &H00000080&
- Height = 252
- Left = 4860
- TabIndex = 12
- ToolTipText = "Sets whether or not non-mouse events are added to the event history."
- Top = 600
- Value = 1 'Checked
- Width = 1452
- End
- Begin VB.CheckBox chkMouseEvents
- Caption = "Mouse Events"
- ForeColor = &H00000080&
- Height = 252
- Left = 4860
- TabIndex = 11
- ToolTipText = "Sets whether or not mouse events are added to the event history."
- Top = 300
- Value = 1 'Checked
- Width = 1452
- End
- Begin VB.ListBox lstEvents
- Height = 1200
- ItemData = "frmMain.frx":0000
- Left = 120
- List = "frmMain.frx":0002
- TabIndex = 10
- ToolTipText = "Displays a history of events raised by the Animation control"
- Top = 240
- Width = 4632
- End
- End
- Begin Animation.ccrpAnimation ccrpAnimation
- Height = 1752
- Left = 300
- Top = 120
- Width = 6372
- _ExtentX = 11240
- _ExtentY = 3090
- AutoOpen = 0 'False
- BackColor = -2147483644
- BorderStyle = 0
- Center = -1 'True
- End
- Begin VB.Frame fra
- Caption = "Information"
- ForeColor = &H00C00000&
- Height = 1092
- Index = 2
- Left = 300
- TabIndex = 17
- Top = 5220
- Width = 6372
- Begin VB.Label lblInfo
- Caption = $"frmMain.frx":0004
- ForeColor = &H000000FF&
- Height = 612
- Left = 180
- TabIndex = 18
- Top = 300
- Width = 6072
- WordWrap = -1 'True
- End
- End
- Begin VB.Frame fra
- Caption = "AVI"
- ForeColor = &H00C00000&
- Height = 1632
- Index = 0
- Left = 3540
- TabIndex = 16
- Top = 1920
- Width = 3132
- Begin VB.ComboBox cboAVI
- Height = 288
- HelpContextID = 9
- ItemData = "frmMain.frx":00D4
- Left = 180
- List = "frmMain.frx":0100
- TabIndex = 6
- ToolTipText = "The animation to play"
- Top = 600
- Width = 2472
- End
- Begin VB.CommandButton cmdPlay
- Caption = "Play"
- Enabled = 0 'False
- Height = 372
- HelpContextID = 15
- Left = 1620
- TabIndex = 9
- ToolTipText = "Plays the animation"
- Top = 1020
- Width = 1212
- End
- Begin VB.CommandButton cmdOpen
- Caption = "Open"
- Enabled = 0 'False
- Height = 372
- HelpContextID = 11
- Left = 240
- TabIndex = 8
- ToolTipText = "Opens the animation"
- Top = 1020
- Width = 1212
- End
- Begin VB.CommandButton cmdBrowse
- Caption = "..."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.6
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 2760
- TabIndex = 7
- ToolTipText = "Browse for an AVI file"
- Top = 660
- Width = 270
- End
- Begin VB.CheckBox chkAutoPlay
- Caption = "AutoPlay"
- ForeColor = &H00000080&
- Height = 252
- HelpContextID = 2
- Left = 180
- TabIndex = 5
- ToolTipText = "Sets whether the AVI starts playing automatically once it is loaded."
- Top = 240
- Value = 1 'Checked
- Width = 2832
- End
- End
- Begin VB.Frame fra
- Caption = "Styles"
- ForeColor = &H00FF0000&
- Height = 1632
- Index = 1
- Left = 300
- TabIndex = 14
- Top = 1920
- Width = 3132
- Begin VB.ComboBox cbo3DEffect
- Height = 288
- ItemData = "frmMain.frx":0169
- Left = 1260
- List = "frmMain.frx":0176
- Style = 2 'Dropdown List
- TabIndex = 3
- ToolTipText = "Sets the appearance with which the animation control is drawn"
- Top = 840
- Width = 1632
- End
- Begin VB.CheckBox chkCenter
- Caption = "Center"
- ForeColor = &H00000080&
- Height = 192
- HelpContextID = 6
- Left = 1500
- TabIndex = 2
- ToolTipText = "Sets whether the animation is centered in the control"
- Top = 300
- Value = 1 'Checked
- Width = 1452
- End
- Begin VB.CheckBox chkBorder
- Caption = "Border"
- ForeColor = &H00000080&
- Height = 192
- Left = 180
- TabIndex = 0
- ToolTipText = "Sets whether a black border is drawn around the control"
- Top = 300
- Width = 1212
- End
- Begin VB.CheckBox chkTransparent
- Caption = "Transparent"
- ForeColor = &H00000080&
- Height = 192
- HelpContextID = 5
- Left = 180
- TabIndex = 1
- ToolTipText = "Sets whether the control is transparent or whether the background colour from the animation is used."
- Top = 540
- Value = 1 'Checked
- Width = 2712
- End
- Begin VB.ComboBox cboTimer
- Enabled = 0 'False
- ForeColor = &H00000000&
- Height = 288
- HelpContextID = 20
- ItemData = "frmMain.frx":0190
- Left = 1260
- List = "frmMain.frx":019A
- Style = 2 'Dropdown List
- TabIndex = 4
- ToolTipText = "Sets the method of synchronisation used whilst playing the animation (IE3+ version of COMCTL32.DLL only)"
- Top = 1200
- Width = 1632
- End
- Begin VB.Label lbl
- Caption = "Appearance:"
- ForeColor = &H00000080&
- Height = 192
- Index = 1
- Left = 180
- TabIndex = 20
- Top = 900
- Width = 1032
- End
- Begin VB.Label lbl
- Caption = "Timer Type:"
- ForeColor = &H00000080&
- Height = 192
- Index = 0
- Left = 180
- TabIndex = 15
- Top = 1260
- Width = 972
- End
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cbo3DEffect_Click()
- ccrpAnimation.Appearance = cbo3DEffect.ItemData(cbo3DEffect.ListIndex)
- End Sub
- Private Sub cboAVI_Change()
- On Error Resume Next
- If ccrpAnimation.Status > aniEmpty Then ccrpAnimation.CloseAVI
- cmdOpen.Enabled = cboAVI.Text > ""
- cmdPlay.Enabled = cboAVI.Text > ""
- End Sub
- Private Sub cboAVI_Click()
- cboAVI_Change
- End Sub
- Private Sub cboTimer_Click()
- 'If the IE3+ version of COMCTL32.DLL is being used (determined by ComCtlVer),
- 'then the control can use a Win32 Timer to synchronise playback rather than
- 'a thread which is the default
- On Error Resume Next
- With ccrpAnimation
- .StopPlaying
- .TimerType = cboTimer.ItemData(cboTimer.ListIndex)
- .OpenAVI 'Reopen so changes take effect
- End With
- End Sub
- Private Sub ccrpAnimation_Click()
- If chkMouseEvents Then AddItemToList "Click"
- End Sub
- Private Sub ccrpAnimation_DblClick()
- If chkMouseEvents Then AddItemToList "DblClick"
- End Sub
- Private Sub ccrpAnimation_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If chkMouseEvents Then AddItemToList "MouseDown: Button = " & Str(Button) & "; Shift = " & Str(Shift) & "; X = " & Str(X) & "; Y = " & Str(Y)
- End Sub
- Private Sub ccrpAnimation_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If chkMouseEvents Then AddItemToList "MouseMove: Button = " & Str(Button) & "; Shift = " & Str(Shift) & "; X = " & Str(X) & "; Y = " & Str(Y)
- End Sub
- Private Sub ccrpAnimation_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If chkMouseEvents Then AddItemToList "MouseUp: Button = " & Str(Button) & "; Shift = " & Str(Shift) & "; X = " & Str(X) & "; Y = " & Str(Y)
- End Sub
- Private Sub ccrpAnimation_StatusChanged(OldStatus As Animation.aniStatusConstants, NewStatus As Animation.aniStatusConstants)
- If chkOtherEvents Then AddItemToList "StatusChanged: From " & GetStatusString(OldStatus) & " To " & GetStatusString(NewStatus)
- Select Case NewStatus
- Case aniEmpty
- cmdOpen.Enabled = cboAVI.Text > ""
- cmdPlay.Enabled = cboAVI.Text > ""
- Case aniOpened
- cmdPlay.Caption = "Play"
- cmdPlay.Enabled = True
- Case aniPlaying
- cmdPlay.Caption = "Stop"
- cmdPlay.Enabled = True
- Case aniStopped
- cmdPlay.Caption = "Play"
- cmdPlay.Enabled = True
- End Select
- End Sub
- Private Sub chkAutoPlay_Click()
- ccrpAnimation.AutoPlay = CBool(chkAutoPlay.Value)
- End Sub
- Private Sub chkBorder_Click()
- 'Sets whether or not a black border is drawn around the control
- ccrpAnimation.BorderStyle = chkBorder.Value
- End Sub
- Private Sub chkCenter_Click()
- 'Centre's the AVI in the control.
- 'Have to refresh and reopen AVI to effect changes
- Dim Status As aniStatusConstants
- With ccrpAnimation
- Status = .Status
- .Center = chkCenter.Value
- If Status > aniEmpty Then cmdOpen_Click
- If Status = aniPlaying Then .Play
- .Refresh
- End With
- End Sub
- Private Sub chkTransparent_Click()
- 'If the control is not transparent, the background colour
- 'is as defined in the AVI
- Dim Status As aniStatusConstants
- With ccrpAnimation
- Status = .Status
- If chkTransparent.Value = 0 Then .BackStyle = aniOpaque Else .BackStyle = aniTransparent
- If Status > aniEmpty Then cmdOpen_Click
- If Status = aniPlaying Then .Play
- End With
- End Sub
- Private Sub cmdBrowse_Click()
- cboAVI.Text = OpenFileForAVI
- End Sub
- Private Sub cmdClearEvents_Click()
- lstEvents.Clear
- End Sub
- Private Sub cmdOpen_Click()
- On Error GoTo ErrorHandler
- If cboAVI.ListIndex > -1 Then
- ccrpAnimation.OpenStandardAVIResource (cboAVI.ItemData(cboAVI.ListIndex))
- Else
- ccrpAnimation.OpenAVI cboAVI.Text
- End If
- Exit Sub
- ErrorHandler:
- MsgBox "Error: " & Str(Err.Number) & " - " & Err.Description
- Resume Next
- End Sub
- Private Sub cmdPlay_Click()
- On Error Resume Next
- If cmdPlay.Caption = "Play" Then
- ccrpAnimation.Play
- Else
- ccrpAnimation.StopPlaying
- End If
- End Sub
- Private Sub cmdEnd_Click()
- End
- End Sub
- Private Sub Form_Load()
- 'Neat trick from Karl...
- Set Me.Icon = Nothing
- cboTimer.ListIndex = 0
- cbo3DEffect.ListIndex = 0
- 'The ComCtlVer property returns the version of COMCTL32.DLL
- 'installed on this machine.
- 'If it is not installed, advanced features provided by the
- 'updated version will not work but no error will occur
- 'ComCtlVer property returns an integer indicating the version currently in use:
- ' 400 - v4.00.950 (supplied with Win95 etc)
- ' 470 - v4.70 (installed with IE3)
- ' 471 - v4.71 (installed with IE4)
- Select Case ccrpAnimation.ComCtlVer
- Case 400
- 'Standard Win95 version
- lblInfo.Caption = "COMCTL32.DLL installed on this machine is not updated version. Timer Type option not available"
- Case 470
- 'IE3 version
- lblInfo.Caption = "COMCTL32.DLL installed on this machine is IE3 or higher version. Timer Type option available"
- cboTimer.Enabled = True
- Case Is >= 471
- lblInfo.Caption = "COMCTL32.DLL installed on this machine is IE4 or higher version. Timer Type option available"
- cboTimer.Enabled = True
- End Select
- End Sub
- Private Sub AddItemToList(Item As String)
- With lstEvents
- .AddItem Item
- .ListIndex = .ListCount - 1
- End With
- End Sub
- Private Function GetStatusString(Status As aniStatusConstants) As String
- Select Case Status
- Case aniEmpty
- GetStatusString = "Empty"
- Case aniOpened
- GetStatusString = "Open"
- Case aniPlaying
- GetStatusString = "Playing"
- Case aniStopped
- GetStatusString = "Stopped"
- End Select
- End Function
-